package com.webgis.backendservice.service.Impl;

import com.webgis.backendservice.mapper.UserMapper;
import com.webgis.backendservice.pojo.User;
import com.webgis.backendservice.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    @Override
    public int login(User user) {
        List<User> res= userMapper.login(user.getUsername(),user.getPassword());
        int len=res.size();
        if(len>0){
            return 0;

        }else{
            return -1;

        }
    }

    @Override
    public int register(User user) {
        return userMapper.register(user.getUsername(), user.getPassword());
    }

}

